{! extends "base.html" !}
{! block meta_block !}
{%if post.tagNames%}<meta name="Keywords" content="{{post.tagNames}},{{site.keywords}}" />
{%else%}<meta name="Keywords" content="{{site.keywords}}" />{%endif%}
{%if post.excerpt%}<meta name="Description" content="{{post.excerpt}}" />{%endif%}
{! endblock !}
{! block title !} {{post.title}} - {{site.title}} {! endblock !}
{! block head_block !}
<script type="text/javascript" src="{{site.url}}js/jquery.min.js"></script>
<script type="text/javascript" src="{{site.url}}js/jquery.form.js"></script>
<script type="text/javascript" src="{{site.url}}ckeditor/ckeditor.js"></script>
{! endblock !}
{! block content!}
<div id="left-content-single">

<div class="post-home">
	<div id="post-title-single">
		<h1><a href="{{post.link}}" rel="bookmark" title="永久链接到{{post.title}}">{{post.title}}</a></h1>
	</div>
	<div class="post-content">
		<div id="post-messages-single">
			<span class="post-msg">{% if post.tagNames %}Tags: {%for tag in post.tags%}<a href="{{site.url}}tag/{{tag.slogan}}.html">{{tag.name}}</a> {%endfor%}{%endif%}  Posted in {%for cate in post.categories%} <a href="{{site.url}}category/{{cate.slogan}}.html">{{cate.name}}</a> {%endfor%}  {%if self.is_admin%}<a href="{{site.url}}jva.log?a=Post&d=edit&id={{post.id}}">Edit</a>  {%endif%} </span><span class="post-comment">:-)<a href="#comment" >说点什么吧</a></span>
		</div>
		{# <div class="ad280">
			 <script type="text/javascript">
				google_ad_client = "pub-6795548912714843";
				google_ad_slot = "8320640581";
				google_ad_width = 250;
				google_ad_height = 250;
			</script>
			<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> 
		</div> #}
		{{ post.article }}
		{% if post.source %}
		<p>&nbsp;</p><div>内容来源： <a href="{{post.source}}">{{post.source}}</a></div>	
		{% endif %}
		<div class="post-time">{{post.date|date:"HH:mm yyyy-MM-dd",site.timezone}}</div>
	</div>
	{%if relateposts%}
    <div id="relate-post">
		<h3>Relate Posts:<span>// 相关文章</span></h3>
            <ul>
            {%for post in relateposts%}
                <li><a href="{{post.link}}">{{post.title}}<span>{{post.date|date:"HH:mm yyyy-MM-dd",site.timezone}}</span></a></li>
            {%endfor%}
            </ul>
	</div>
    {%endif%}
</div>    
<div id="post-messages-single">
<div style="float:right;height:10px">
{%if post.next%}
<a href="{{next.link}}">{{next.title}}»</a>
{%endif%}
</div>
<div style="float:left">
{%if post.prev%}
<a href="{{prev.link}}">«{{prev.title}}</a>
{%endif%}
</div>
</div>

<div id="comment">
{! include "comments.html" !}
</div>

</div>

{! include "sidebar.html" !}
{! endblock !}
{!block script !}
<script type="text/javascript">
var editor;

$("#inputArea").click(function() {
	if (window.editor) return;
	window.editor = CKEDITOR.replace('commentEditor', 
			{
		enterMode : 2,//enter press add a <br />
		resize_enabled : false,
		toolbar : 'Basic'
			});
});

$("#submit").click(function(){
	if (window.editor) {
		document.getElementById("commentEditor").value = window.editor.getData();
	}
});

$(function() { 
	var options = {
		dataType: 'json',
		success : function(data) {
			var hmd = $("#hiddenMessage");
			if (data.type == "error") {
				hmd.html("<div class='error'>" + data.message + "</div>");
			} else {
				$("#submit").hide();
				if ( data.action ) {
					window.location = window.location.href;
					return;
				} else {
					hmd.html("<div class='info'>" + data.message + "</div>");
				}
			}
			hmd.show();
		},
	};
	$("#commentForm").ajaxForm(options);
});
</script>
{! endblock !}